Skip to content

Conversation

@lucasly-ba
Copy link

@lucasly-ba lucasly-ba commented Oct 14, 2025

Derive may only be applied to structs, enums and unions.

Fixes #3971

gcc/rust/ChangeLog:

* expand/rust-expand-visitor.cc(ExpandVisitor::expand_inner_items): Added check and error.

gcc/testsuite/ChangeLog:

* rust/compile/issue-3971.rs: New test.

Signed-off-by: Lucas Ly Ba [email protected]

@lucasly-ba lucasly-ba force-pushed the 3972 branch 4 times, most recently from bdc4c1b to c246504 Compare October 16, 2025 16:43
Derive may only be applied to structs, enums and unions.

gcc/rust/ChangeLog:

	* expand/rust-derive.cc (DeriveVisitor::derive):
	Add check and error.

gcc/testsuite/ChangeLog:

	* rust/compile/issue-3971.rs: New test.

gcc/rust/ChangeLog:

	* expand/rust-derive.cc (DeriveVisitor::derive):
	* expand/rust-expand-visitor.cc:

gcc/testsuite/ChangeLog:

	* rust/compile/issue-3971.rs: New test.

Signed-off-by: Lucas Ly Ba <[email protected]>

#include "rust-expand-visitor.h"
#include "rust-ast-fragment.h"
#include "rust-diagnostics.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no modification within rust-expand-visitor.cc, is this include really required ?

{
auto loc = attr.get_locus ();

using kind = AST::Item::Kind;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use an uppercase Kind alias here to avoid confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

segfault in expansion

3 participants